<style>
    .report-table td {
        padding: 8px 5px;
    }
</style>
<? foreach ($anketa as $res){ 
        $id = $res->id; 
        $status = $res->status;  
} ?>
<? if($status==2){?>
    <style> 
        #minireport #mheader .mini-meta span{
            color: #AAAAAA;
            background: url(<?=base_url()?>assets/img/backgrounds/item-closed.png) no-repeat scroll 0 5px transparent;
        }
    </style>  
    <?};?>
<div id="mheader">
    <h2><?=$naziv_ankete; ?></h2>
    <div id="mini-meta-container">
        <div class="mini-meta">
            <small>Status</small>
            <div id="drop-hover">
                <span id="main-status" >
                    <? if($status==1)echo 'Aktivan';?>
                    <? if($status==2)echo 'Zatvoren';?>
                </span>
            </div>
        </div>
        <div class="mini-meta">
            <small>Glasova</small>
            <p><?=$rezultati[0][0]?></p>
        </div>
    </div>
    <ul class="navcontrol nopadding right mini-meta-tabs">
        <li><a class="link-edit side-left" href="<?=base_url()?>anketa/uredi_anketu/index/TRUE/<?=$id; ?>">Uredi anketu</a></li>
        <li class="space">&nbsp;</li>
        <li><a class="link-slider embeded-code" href="javascript:void(0)" id="<?=$id;?>">On-site code</a></li>
        <li class="space">&nbsp;</li>
        <li><a class="link-view preview side-right" href="<?=base_url()?>anketa/uredi_anketu/anketa_prikaz/<?=$id;?>">Prikazi anketu</a></li>
    </ul>
    <p class="clear"></p>
</div>
<div id="mini-report-body">
    <div style="width: 400px;" class="report-box">
        <div class="head">
            <h4>Rezultati glasanja</h4>
            <p class="clear"></p>
        </div>
        <div style="height: 210px;" class="box">
            <div class="inner">
                <? if($rezultati[0][0]==0){?>
                    <div class="no-votes">Još uvek niste prikupili glasove na ovoj anketi. Kada to uradite, moćićete da ih vidite ovde!</div>
                    <?}else{?>
                    <div style="height: 100px; width: 100px; float: left; margin-top: 27px; position: relative;" id="small-chart">
                        <?
                            $strXML = "<graph decimalPrecision='0' showValues='0' bgcolor='FFFFFF' bgAlpha='0' pieYScale='0' pieBorderAlpha='40' pieFillAlpha='100' pieSliceDepth='15' pieRadius='50'>";
                            $strXML = "<graph decimalPrecision='0' showPercentageValues='1' showNames='0' numberPrefix='' showValues='0' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='100' pieRadius='49' animation='0' shadowXShift='0' shadowYShift='0' shadowAlpha='0' pieFillAlpha='95' pieBorderColor='FEFEFE'>";

                            foreach ($rezultati as $arSubData){
                                $strXML .= "<set name='" . $arSubData[1] . "' value='" . $arSubData[2] . "' color='". getFCColor()."' hoverText='' showName='1'/>";  
                            }
                            $strXML .= "<trendlines><line startValue='26000' color='91C728' displayValue='Target' showOnTop='1'/></trendlines>";
                            $strXML .= "</graph>";
                            echo renderChart(base_url()."assets/charts/FCF_Pie2D.swf", "", $strXML, "pieChart", 100, 100);
                        ?>
                    </div>
                    <div style="width: 270px; float: right; height: 200px; overflow: auto;">
                        <table cellspacing="0" class="report-table pie-graph">
                            <thead>                        
                                <tr>
                                    <th class="point-th"></th>
                                    <th style="margin: 0px; padding: 0px;" class="point-th">
                                        <div style="margin: 0px; padding: 0px;" class="report-box">
                                            <div style="width: 120px; margin: 0px; padding: 0px;" class="head">
                                                <ul>
                                                    <li style="margin: 0px; padding: 0pt 4px 0pt 0pt;"><a href="javascript:void(0)" id="count" class="swap-resp on">Broj</a></li>
                                                    <li style="margin: 0px; padding: 0pt 4px 0pt 0pt;">|</li>
                                                    <li style="margin: 0px; padding: 0pt 4px 0pt 0pt;"><a href="javascript:void(0)" id="percent" class="swap-resp">Procenat</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <?
                                    global $FC_ColorCounter; 
                                    $FC_ColorCounter = 0;
                                    foreach ($rezultati as $arSubData){?>
                                    <tr>
                                        <td class="answer-right answer-poll" style="width: 360px;">
                                            <div style="float: left; width: 10px; background-color: #<?=getFCColor()?>" class="color-code" id="poll-result-0"></div>
                                            <div style="float: left; width: 84px;"><?=$arSubData[1];?></div>
                                        </td>
                                        <td class="num-strong no-right">
                                            <div class="votes count"><?=$arSubData[2];?></div>
                                            <div class="votes percent" style="display: none;"><?=$arSubData[3];?>%</div>
                                        </td>
                                    </tr>
                                    <?}?>
                            </tbody>
                        </table>
                    </div>
                    <div class="clear"></div>
                    <?}?>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    <div>
        <h2 style="margin-top: 20px;">Opcije ankete</h2>
        <ul class="navcontrol nopadding">
            <li>  
                <a class="side-left link-refresh toggle-item closed open-poll" href="javascript:void(0)" id="<?=$id;?>" <? if($status==1)echo ' style="display: none;"';?>>Otvori</a>
                <a class="side-left link-refresh toggle-item open close-poll" href="javascript:void(0)" id="<?=$id;?>" <? if($status==2)echo ' style="display: none;"';?>>Zatvori</a>
            </li>
            <li class="space">&nbsp;</li>
            <li><a class="link-delete delete-item side-right delete-poll" href="javascript:void(0)" id="<?=$id;?>">Obriši</a></li>
        </ul>
    </div>
    <div class="clear"></div> 
</div>
